{% extends 'base/base_width_left.html' %}
{% block flag %}playbooks{% endblock %}
{% block path %}
    <a href="{% url 'playbooks:list' %}" title="" class="tip-bottom"> 剧本管理</a>
    <a href="{% url 'playbooks:file_list' %}?pbid={{ pbid }}" title="" class="tip-bottom"> 剧本列表</a>
    <a href="" title="" class="tip-bottom"> 剧本版本编辑</a>
{% endblock %}
{% block container %}
    <form action="" method="POST" onsubmit="return true" class="form-horizontal" enctype="multipart/form-data"
          novalidate="novalidate">
    {% csrf_token %}
{#        <input type="hidden" name="csrfmiddlewaretoken"#}
{#               value="Ag2eKvps2psCjRWxhm4LLeXAkLhQfDW1ZszaQpDfwxYJHM8VnjaLFGMuY4i1acMj">#}
        <div class="form-group"><label class="col-sm-2 control-label" for="id_playbooks">剧本管理</label>
            <div class="col-sm-4">
{#                <select name="playbooks" title="" required=""#}
{#                                          class="form-control input-lg null active" id="id_playbooks">#}
{#                <option value="" selected="">---------</option>#}
{##}
{#                <option value="1">微信用户</option>#}
{##}
{#                <option value="2">撒地方</option>#}
{##}
{#            </select>#}
                <input hidden name="playbooks" value="{{pbid }}"/>
                <input name="" value="{{ pb_name }}" title="" required="" disabled id="id_playbooks" maxlength="50"
                       placeholder="" class="form-control input-lg null" type="text">
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="id_content">剧本描述</label>
            <div class="col-sm-4">
                {#        <textarea name="content" rows="10" title="" type="text" required="" cols="40" id="id_content" maxlength="500" placeholder="版本描述" class="form-control input-lg null"></textarea>#}
                {{ form.content }}
                <p style="color:red">{{ form.content.errors }}</p>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="id_version">剧本版本</label>
            <div class="col-sm-4">
                {#        <input type="text" name="version" title="" required="" id="id_version" maxlength="200" placeholder="版本" class="form-control input-lg null">#}
                {{ form.version }}
                <p style="color:red">{{ form.version.errors }}</p>
                <p style="color:red" id="version_error"></p>
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="id_path">剧本</label>
            <div class="col-sm-4">
                {{ form.path }}
                <p style="color:red">{{ form.path.errors }}</p>
{#                <input type="text" name="path" title="" upimginfo="image,0,0" required="" id="id_path"#}
{#                       readonly="readOnly" maxlength="1000" placeholder="剧本" class="form-control upload_file">#}
{#                <div style="display:inline;">#}
{#                    <div id="up_file" class="uploadify" style="height: 33px; width: 94px;">#}
{#                        <object id="SWFUpload_0" type="application/x-shockwave-flash"#}
{#                                data="/static/uploadify/uploadify.swf?preventswfcaching=1507869175904" width="94"#}
{#                                height="33" class="swfupload" style="position: absolute; z-index: 1;">#}
{#                            <param name="wmode" value="transparent">#}
{#                            <param name="movie" value="/static/uploadify/uploadify.swf?preventswfcaching=1507869175904">#}
{#                            <param name="quality" value="high">#}
{#                            <param name="menu" value="false">#}
{#                            <param name="allowScriptAccess" value="always">#}
{#                            <param name="flashvars"#}
{#                                   value="movieName=SWFUpload_0&amp;uploadURL=%2Fupload%2Fupload_file%2F%3Fstate%3Dfile&amp;useQueryString=false&amp;requeueOnError=false&amp;httpSuccess=&amp;assumeSuccessTimeout=30&amp;params=&amp;filePostName=Filedata&amp;fileTypes=&amp;fileTypesDescription=All%20Files&amp;fileSizeLimit=1024000&amp;fileUploadLimit=0&amp;fileQueueLimit=1&amp;debugEnabled=false&amp;buttonImageURL=&amp;buttonWidth=94&amp;buttonHeight=33&amp;buttonText=&amp;buttonTextTopPadding=0&amp;buttonTextLeftPadding=0&amp;buttonTextStyle=color%3A%20%23000000%3B%20font-size%3A%2016pt%3B&amp;buttonAction=-100&amp;buttonDisabled=false&amp;buttonCursor=-2">#}
{#                        </object>#}
{#                        <div id="up_file-button" class="uploadify-button btn"#}
{#                             style="background-image: url(&quot;/static/image/up_file.jpg&quot;); text-indent: -9999px; height: 33px; line-height: 33px; width: 94px;">#}
{#                            <span class="uploadify-button-text">SELECT FILES</span>#}
{#                        </div>#}
{#                    </div>#}
{#                    <div id="up_file-queue" class="uploadify-queue">#}
{##}
{#                    </div>#}
{#                </div>#}
            </div>
        </div>
        <div class="form-group">
            <label class="col-sm-2 control-label" for="id_upload_file">剧本附件</label>
            <div class="col-sm-4">
                {{ form.upload_file }}
                <p hidden id="up_zip_p"><a class="btn btn-default" href="javascript:$('#up_zip').uploadify('upload','*')">上传</a></p>
{#                <input type="text" name="upload_file" title="" upimginfo="image,0,0" id="id_upload_file"#}
{#                       readonly="readOnly" maxlength="1000" placeholder="剧本所需文件" class="form-control upload_zip">#}
{#                <div style="display:inline;">#}
{#                    <div id="up_zip" class="uploadify" style="height: 33px; width: 94px;">#}
{#                        <object id="SWFUpload_1" type="application/x-shockwave-flash"#}
{#                                data="/static/uploadify/uploadify.swf?preventswfcaching=1507869175917" width="94"#}
{#                                height="33" class="swfupload" style="position: absolute; z-index: 1;">#}
{#                            <param name="wmode" value="transparent">#}
{#                            <param name="movie" value="/static/uploadify/uploadify.swf?preventswfcaching=1507869175917">#}
{#                            <param name="quality" value="high">#}
{#                            <param name="menu" value="false">#}
{#                            <param name="allowScriptAccess" value="always">#}
{#                            <param name="flashvars"#}
{#                                   value="movieName=SWFUpload_1&amp;uploadURL=%2Fupload%2Fupload_file%2F%3Fstate%3Dzip&amp;useQueryString=false&amp;requeueOnError=false&amp;httpSuccess=&amp;assumeSuccessTimeout=30&amp;params=&amp;filePostName=Filedata&amp;fileTypes=&amp;fileTypesDescription=All%20Files&amp;fileSizeLimit=1024000&amp;fileUploadLimit=0&amp;fileQueueLimit=1&amp;debugEnabled=false&amp;buttonImageURL=&amp;buttonWidth=94&amp;buttonHeight=33&amp;buttonText=&amp;buttonTextTopPadding=0&amp;buttonTextLeftPadding=0&amp;buttonTextStyle=color%3A%20%23000000%3B%20font-size%3A%2016pt%3B&amp;buttonAction=-100&amp;buttonDisabled=false&amp;buttonCursor=-2">#}
{#                        </object>#}
{#                        <div id="up_zip-button" class="uploadify-button btn"#}
{#                             style="background-image: url(&quot;/static/image/up_file.jpg&quot;); text-indent: -9999px; height: 33px; line-height: 33px; width: 94px;">#}
{#                            <span class="uploadify-button-text">SELECT FILES</span></div>#}
{#                    </div>#}
{#                    <div id="up_zip-queue" class="uploadify-queue"></div>#}
{#                </div>#}
            </div>
        </div>


        <div class="form-group">
            <button type="submit" class="btn btn-primary col-xs-11 col-md-1 col-md-offset-3">保
                存
            </button>
            <!-- 				<a href="" class="btn btn-default col-xs-11 col-md-1 col-md-offset-1">返回</a> -->
        </div>


    </form>

    {#    <ul class="nav nav-tabs">#}
    {#        <li role="presentation" class="active"><a href="">剧本版本编辑</a></li>#}
    {#        {% if pbid %}#}
    {#        <li role="presentation"><a href="{% url 'playbooks:file_list' %}?pbid={{ pbid }}">剧本运行</a></li>#}
    {#        {% endif %}#}

    {#    </ul>#}
{% endblock %}
{% block footjs %}
    <script type="text/javascript" src="/static/uploadify/jquery.uploadify.min.js"></script>
    <script type="text/javascript" src="/static/uploadify/uploadify_file.js"></script>
    {#    <script type="text/javascript" src="/static/uploadify/uploadimg.js"></script>#}
    <script>
        $("#id_version").on("change",function(){
            var in_version=$(this).val();
            $.get("{% url 'playbooks:version_is_exist' %}",{pbid:{{ pbid }},version:in_version},function(data){
                if(data.code==1){
                    $("#version_error").text(' ');
                    version = in_version;
                }else{
                    $("#version_error").text(data.msg);
                }
            })
        })
{#        $('#up_file').on('click',function(){#}
{#            var version=$("id_version").val();#}
{#            if(version==''){#}
{#                alert("请先输入版本")#}
{#            }#}
{#        })#}
    </script>
{% endblock %}
{#<div class="col-sm-4">#}
{#    <input type="text" name="path" value="/home/hcx/workspace/autodeploy/autodeploy/uplod/task/information" title="" upimginfo="image,0,0" required="" id="id_path" readonly="readOnly" maxlength="1000" placeholder="剧本路径" class="form-control imginput">#}
{#    <div style="display:inline;"><a class="btn btn-default" onclick="upload_iframe(this,'image',0,0)">#}
{#        <span class="glyphicon glyphicon-upload" aria-hidden="true"></span>#}
{#        上传图片</a>&nbsp;<a class="btn btn-default" onclick="delete_img(this)">清除图片</a>#}
{#        <span name="" class="upimg">/home/hcx/workspace/autodeploy/autodeploy/uplod/task/information</span>#}
{#    </div>#}
{#    <div class="preview_img"><br>#}
{#        <img width="100px" src="/home/hcx/workspace/autodeploy/autodeploy/uplod/task/information?2014">#}
{#    </div>#}
{#</div>#}